layui.define(['setter','admin'], function(exports){
    var theme = {}
    ,admin = layui.admin
    ,view  = layui.view
    ,$ = layui.$
    ,$body = $('body')
    ,events = admin.events;
    admin.events = $.extend(admin.events,{
        caseTheme:function(){
            admin.popupRight({
                id: 'LAY_adminPopupTheme'
                ,success: function(){
                    view(this.id).render('system/caseTheme')
                }
            });
        }
    })
    // layui.admin.events.caseTheme()
    // console.log(events===layui.admin.events)
    var html = `<li class="layui-nav-item layui-hide-xs" lay-unselect>
        <a href="javascript:;" layadmin-event="caseTheme">
        <i class="layui-icon layui-icon-theme"></i>
        </a>
    </li>`

    var themeList = [
        {
            themeName:'giky'
            ,name:"正点"
            ,simg:"simg.jpg"
        }
        ,{
            themeName:'yoyo'
            ,name:"正点22222"
            ,simg:"simg.jpg"
        }
    ]
    layui.each(themeList, function(index, item){
         console.log(item)
    })
    $(".layui-layout-right").prepend(html)

    var cloudCss = document.getElementById("cloudCss");
    var logoHtml = $('.zk-logo');
    var themeName= 'giky'
    if(cloudCss){
    cloudCss.setAttribute("href","/public/res/css/"+themeName+"-skin.css");
    // logoHtml.html(options.color.logoHtml);
    // console.log(options.color.logoHtml); 
    }
    console.log(33,cloudCss)

    //点击事件
  $body.on('click', '*[layadmin-event]', function(){
    var othis = $(this)
    ,attrEvent = othis.attr('layadmin-event');
    events[attrEvent] && events[attrEvent].call(this, othis);
    // console.log(events)
  });
  //接口输出
  exports('theme', themeList);
});